package com.shisfish.english.controller;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.shisfish.core.controller.BaseController;
import com.shisfish.core.dto.ResultDto;
import com.shisfish.english.model.Note;

@Controller
@RequestMapping(value = "/note", produces = "application/json; charset=utf-8")
public class NoteController extends BaseController {

	@ResponseBody
	@RequestMapping(value = "/searchByParams")
	public String searchByParams(String content, Long category) {
		ResultDto<List<Note>> resultDto = noteService.selectByParams(content, category);
		return JSON.toJSONString(resultDto);
	}

	@ResponseBody
	@RequestMapping(value = "/page/{pageIndex}/{pageSize}")
	public String searchByParams(@PathVariable("pageIndex") Integer pageIndex,
			@PathVariable("pageSize") Integer pageSize, String content, Long category) {
		ResultDto<List<Note>> resultDto = noteService.pageByParams(pageIndex, pageSize, content, category);
		return JSON.toJSONString(resultDto);
	}

	@ResponseBody
	@RequestMapping(value = "/add")
	public String add(Integer category, String content) {

		return null;
	}

}
